<template>
    <div class="container">
        <div class="handle-box">
                <el-form ref="form" :model="form" label-width="90px" class="flex">
                    <el-form-item label="所属街道：">
                        <el-input v-model="name" placeholder="请输入名称" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="社区名称：">
                        <el-input v-model="name" placeholder="请输入名称" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="日期范围：">
                       <el-date-picker
                            v-model="value1"
                            type="daterange"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search">搜索</el-button>
                    </el-form-item>
                    
                </el-form>
            </div>
            <el-table
                :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)"
            >
                <el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>
                <el-table-column prop="address" label="所属街道"></el-table-column>
                <el-table-column prop="community" label="社区名称"></el-table-column>
                <el-table-column prop="date" label="日期范围"></el-table-column>
                <el-table-column prop="integral" label="可回收垃圾累计称重(吨)"></el-table-column>
                <el-table-column prop="chuyuintegral" label="厨余收垃圾累计称重(吨)"></el-table-column>
                <el-table-column prop="youhaiintegral" label="有害收垃圾累计称重(吨)"></el-table-column>
                <el-table-column prop="qitaintegral" label="其他收垃圾累计称重(吨)"></el-table-column>
                <el-table-column prop="totalscore" label="总称重(吨)"></el-table-column>
                <el-table-column label="操作" width="180" align="center">
                    <template slot-scope="scope">
                        <el-button
                            type="text"
                            icon="el-icon-edit"
                            @click="handleEdit(scope.$index, scope.row)"
                        >查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination
                    background
                    layout="total, sizes, prev, pager, next, jumper"
                    :current-page="currentPage"  
                    :page-size="pageSize"
                    :total="tableData.length"
                    @size-change="handleSizeChange"
                    @current-change="handlePageChange"
                ></el-pagination>
            </div>
            <!-- 编辑弹出框 -->
             <el-dialog v-dialogDrag title="详情" :visible.sync="editVisible" width="50%" style="padding-top:10px;font-weight:600">
                <el-tabs v-model="activeName" @tab-click="handleClick">
                  <el-tab-pane label="可回收垃圾累计称重(吨)" name="first">
                    <el-form ref="form" :model="form" label-width="100px">
                        <el-form-item label="纸张：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                        <el-form-item label="玻璃：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                        <el-form-item label="金属：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                        <el-form-item label="塑料：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                        <el-form-item label="硬纸板：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                        <el-form-item label="布料：">
                            <el-input v-model="form.name">吨</el-input>
                        </el-form-item>
                    </el-form>
                  </el-tab-pane>
                  <el-tab-pane label="厨余收垃圾累计称重(吨)" name="second">
                    <el-form ref="form" :model="form" label-width="100px">
                    <el-form-item label="家庭厨房：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="餐厅：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="饭店：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="食堂：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="市场：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="食品加工厂：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    </el-form>
                  </el-tab-pane>
                  <el-tab-pane label="有害收垃圾累计称重(吨)" name="third">
                    <el-form ref="form" :model="form" label-width="120px">
                    <el-form-item label="废电池：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="废荧光灯管：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="废灯泡：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="废水银温度计：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="废油漆桶：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="过期药品：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    </el-form>
                  </el-tab-pane>
                  <el-tab-pane label="其他收垃圾累计称重(吨)" name="fourth">
                    <el-form ref="form" :model="form" label-width="100px">
                    <el-form-item label="建筑垃圾：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="砖瓦陶瓷：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="渣土：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="卫生间废纸：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    <el-form-item label="瓷器碎片：">
                        <el-input v-model="form.name">吨</el-input>
                    </el-form-item>
                    </el-form>
                  </el-tab-pane>
                  <!-- <el-tab-pane label="总称重" name="fiveth">定时任务补偿</el-tab-pane> -->
                </el-tabs>
            </el-dialog>
        </div>
</template>
<script>
import '../../assets/css/common.css'

export default {
    data(){
        return{
              currentPage:1, //初始页
                pagesize:10,    //    每页的数据
                userList: [],
                address:'',
                name:'',
                value1: '',
                activeName: 'first',
            tableData: [{
                id: '1',
                address: "向阳路街",
                community: '云阳里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '2',
                address: "向阳路街",
                community: '战备楼社区',
                date: '2020-7-1~2020-7-20',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '3',
                address: "向阳路街",
                community: '延安楼社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '4',
                address: "向阳路街",
                community: '冶金里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '5',
                address: "向阳路街",
                community: '集园里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '6',
                address: "向阳路街",
                community: '留园里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '7',
                address: "向阳路街",
                community: '向阳路社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '8',
                address: "向阳路街",
                community: '昔阳里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '9',
                address: "向阳路街",
                community: '官易里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '10',
                address: "向阳路街",
                community: '跃升里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '11',
                address: "向阳路街",
                community: '宜君里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '12',
                address: "向阳路街",
                community: '芥园中里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '13',
                address: "向阳路街",
                community: '春畅里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '14',
                address: "向阳路街",
                community: '华阳里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '15',
                address: "向阳路街",
                community: '延长里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '16',
                address: "向阳路街",
                community: '大园新居社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '17',
                address: "向阳路街",
                community: '瑞湾花园社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '18',
                address: "向阳路街",
                community: '景园里社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            },{
                id: '19',
                address: "向阳路街",
                community: '燕宇花园社区',
                date: '2020-7-1~2020-7-30',
                integral: '100',
                score: '2',
                remaining:'98',
                chuyuintegral: '200',
                chuyuscore: '1',
                chuyuremaining: '199',
                youhaiintegral: '100',
                youhaiscore:　'2',
                youhairemaining:　'98',
                qitaintegral: '100',
                qitascore: '5',
                qitaremaining: '95',
                totalscore: '358'
            }],
            multipleSelection: [],
            delList: [],
            editVisible: false,
            pageTotal: 0,
            form: {},
            idx: -1,
            id: -1
        }
    },
    created() {
        // this.getData();
    },
    methods: {
        // 获取 easy-mock 的模拟数据
        // getData() {
        //     fetchData(this.query).then(res => {
        //         console.log(res);
        //         this.tableData = res.list;
        //         this.pageTotal = res.pageTotal || 50;
        //     });
        // },
        // 触发搜索按钮
        // handleSearch() {
        //     this.$set(this.query, 'pageIndex', 1);
        //     // this.getData();
        // },
         mohu() {
            var search = this.name;
            console.log(search)
            var newdate = [];
            if(search){
                if(search)
                 this.tableData.filter(item=>{
                    if(item.name.indexOf(search) != -1){
                        newdate.push(item)
                    }
                })
            }else if (search == ''){
                console.log(this.tableData)
            }
            this.tableData = newdate
        },
        // 编辑操作
        handleEdit(index, row) {
            this.idx = index;
            this.form = row;
            this.editVisible = true;
        },
        // 保存编辑
        saveEdit() {
            this.editVisible = false;
            this.$message.success(`修改第 ${this.idx + 1} 行成功`);
            this.$set(this.tableData, this.idx, this.form);
        },
        // 分页导航
        handlePageChange(currentPage) {
            this.currentPage = currentPage;
            console.log(this.currentPage)
            // this.$set(this.query, 'pageIndex', val);
            // this.getData();
        },
        handleSizeChange(size){
            this.pagesize = size;
            console.log(this.pagesize)
        }
    }
}
</script>
<style scoped>

</style>